const Router = require('koa-router')
const {
  verifyAuth,
  verifyPermission 
} = require('../middleware/auth.middleware')
const {
  create,
  update,
  remove,
  list,
  listByUser,
  detail
} = require('../controller/moment.controller')
const momentRouter = new Router({prefix: '/moment'})

// 获取动态列表
momentRouter.get('/list', list)
// 获取用户的动态列表
momentRouter.get('/list/:userId', listByUser)
// 获取动态详细信息
momentRouter.get('/:momentId', detail)

// 添加动态
momentRouter.post('/', verifyAuth, create)

// 修改动态
momentRouter.patch('/:momentId', verifyAuth, verifyPermission, update)
// 删除动态
momentRouter.delete('/:momentId', verifyAuth, verifyPermission, remove)

module.exports = momentRouter